﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.Data;
using Orchard.Entity;
using System.Linq.Expressions;

namespace Orchard.Service
{
    public class WebLogsManager : IWebLogsManager
    {
        IRepository<Web_Logs> _iRepository;
        public WebLogsManager(IRepository<Web_Logs> iRepository)
        {
            _iRepository = iRepository;
        }

        public Web_Logs Get(params object[] id)
        {
            return _iRepository.Get(id);
        }

        public Web_Logs Get(System.Linq.Expressions.Expression<Func<Web_Logs, bool>> predicate)
        {
            return _iRepository.Get(predicate);
        }


        public IEnumerable<Web_Logs> Fetch(System.Linq.Expressions.Expression<Func<Web_Logs, bool>> predicate)
        {
            return _iRepository.Fetch(predicate);
        }

        public IEnumerable<Web_Logs> Fetch(System.Linq.Expressions.Expression<Func<Web_Logs, bool>> predicate, Action<Orderable<Web_Logs>> order)
        {
            return _iRepository.Fetch(predicate, order);
        }
        public IEnumerable<Web_Logs> Fetch(Expression<Func<Web_Logs, bool>> predicate, Action<Orderable<Web_Logs>> order, int skip, int count)
        {
            return Fetch(predicate, order).Skip(skip).Take(count);
        }
        public void Update(Web_Logs entity)
        {
            try
            {
                _iRepository.Update<Web_Logs>(x => new Web_Logs()
                          {
                              LogID = entity.LogID,
                              ExeSQL = entity.ExeSQL,
                              Info = entity.Info,

                          });
                //_iRepository.AddColumn(j => j.OccurTime).AddColumn(i => i.Info);
                //_iRepository.Update(entity);
                _iRepository.SaveChanges();
            }
            catch (Exception)
            {

                throw;
            }

        }

    }
}
